package com.smartcampusbackend.service.impl;

import com.smartcampusbackend.mapper.SchoolAccountMapper;
import com.smartcampusbackend.model.SchoolAccount;
import com.smartcampusbackend.service.SchoolAccountService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.math.BigDecimal;

@Service
public class SchoolAccountServiceImpl implements SchoolAccountService {
    private static final String ACCOUNT_NAME = "校园缴费账户";

    @Autowired
    private SchoolAccountMapper schoolAccountMapper;

    @Override
    public SchoolAccount getAccount() {
        return schoolAccountMapper.selectByAccountName(ACCOUNT_NAME);
    }

    @Override
    public boolean recharge(BigDecimal amount) {
        return schoolAccountMapper.updateBalance(ACCOUNT_NAME, amount) > 0;
    }
} 